<%@include file="init.jsp"%>
<%@include file="header.jsp"%>
<%
	// checks if user is logged in. If so it creates a GUser object
	if ( main.loggedIn() ){
		// attempts to add user if not in datastore
        main.user.userAdd();
	}

	// Just a get request to see if level was attempted to be changed
	String newLevel = request.getParameter("newLeveL");

	// if newLevel was passed try and update its value
	if(newLevel != null && newLevel != ""){
			main.user.updateLevel(Integer.parseInt(newLevel));
	}

	out.print("User: " + main.user.user + "<br>"); // Print email
	out.print(" Current Level: " + main.user.accessLevel); // Print access level
%>

	<br>
	<form action="" method="GET">
	New Access Level: 
		<select name="newLeveL">
			<% for(int i=0; i <=5; i++){
				out.print((main.user.accessLevel == i) ? "<option selected>" + i +"</option>" : "<option>"+i+"</option>");
			}
			%>
		  </select>
	    <input type="submit" name="submit" value="Submit">
	</form>
